# GF_PY3_CLASS/STACK_FIFO_for_Accounting_s_Multi_Accounts.py
# Create by GF 2025-08-15 10:46

import pandas  # Pandas 2.0.3
# ..................................................
import GF_PY3_CLASS_STACK_FIFO_for_Accounting_s_Alone_Account

# ##################################################

class STACK_FIFO_for_Accounting_s_Multi_Accounts(object):

    def __init__(self, Iterable_Object:object, Elements_in_Iterable_Object:list):
    
        self.Pointer:int                                 = 0
        self.Iterable_Object:object                      = Iterable_Object              # 可迭代对象
        self.Elements_in_Iterable_Object:list            = Elements_in_Iterable_Object  # 可迭代对象中的元素
        self.Current_Element:object                      = self.Elements_in_Iterable_Object[self.Pointer]
        self.Quantity_of_Elements_in_Iterable_Object:int = len(self.Elements_in_Iterable_Object)
        self.Counter:int                                 = 1
        self.Process_Output:str                          = "No process output available at the moment."
        # ..........................................
        self.Elements_in_Iterable_Object.append("[DONE]")
        # ..........................................
        self.STACK_FIFO_Accounting_s_Alone = GF_PY3_CLASS_STACK_FIFO_for_Accounting_s_Alone_Account.STACK_FIFO_for_Accounting_s_Alone_Account()

    def Next(self) -> object:

        self.Current_Element = self.Elements_in_Iterable_Object[self.Pointer]
        # ..........................................
        # Iterable Object is "Pandas DataFrame"
        Alone_Account = self.Iterable_Object[self.Iterable_Object["WBS 编码"] == Current_Element]
        # ..........................................
        Alone_Account_Remaining = self.STACK_FIFO_Accounting_s_Alone.Run(Pandas_DataFrame = Alone_Account, return_value = "remaining")
        # ..........................................
        self.Process_Output = f"Processing: {self.Current_Element}, Progress: {self.Counter}/{self.Quantity_of_Elements_in_Iterable_Object}"
        # ..........................................
        self.Pointer = self.Pointer + 1
        self.Counter = self.Counter + 1
        # ..........................................
        return Alone_Account_Remaining

# Signed by GF.
